-
Notifications
You must be signed in to change notification settings - Fork 334
Changes to add powershell commands as wmic is deprecated in windows 2025 #1907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
aadb4e1 to
647d438
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1907 +/- ##
==========================================
+ Coverage 74.26% 74.34% +0.08%
==========================================
Files 79 79
Lines 4395 4409 +14
==========================================
+ Hits 3264 3278 +14
Misses 1131 1131 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
647d438 to
25113e4
Compare
25113e4 to
e14ad56
Compare
|
@skyamgarp thanks for the PR. I'm not really a windows person. Is that a breaking change / does it drop support for specifc older windows versions? |
@bastelfreak I believe it is not available by default beginning windows 2025. https://learn.microsoft.com/en-us/windows-server/get-started/removed-deprecated-features-windows-server |
940089c to
7821028
Compare
lib/beaker/host/windows/group.rb
Outdated
|
|
||
| # using powershell commands as wmic is deprecated in windows 2025 | ||
| def group_list_using_powershell | ||
| result = exec(powershell('"Get-LocalGroup | Select-Object -ExpandProperty Name"')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't used powershell in a decade, so maybe a stupid question: Do we need double quotes within the single quotes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we need to pass this command as string instead of command hence have added quotes.
lib/beaker/host/windows/group.rb
Outdated
| result = exec(powershell('"Get-LocalGroup | Select-Object -ExpandProperty Name"')) | ||
| groups = [] | ||
| result.stdout.each_line do |line| | ||
| groups << line.strip or next |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strip or next neat 👍
2e5043f to
c0df462
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we called powershell.exe -NonInteractive ... then I wonder if we could drop the echo "" | ? But it looks the echo pattern is used elsewhere, so at least we're consistent.
|
@bastelfreak , can you please review and merge the PR? Thanks. |
|
I'm still not quite sure if this is a breaking change or not? |
I did not understand the question, as |
Updated comment Fixed rubocop Add specs for new methods using powershell for user and group Fixed rubocop failures Using powershell DSL Fix rubocop Remove group_list method from pswindows Including DSL::Wrappers inside method Use powershell commands instead of powershell DSL Remove unnecessary changes
c0df462 to
f4eb70e
Compare
This PR is purely additive (because we backed out the including the DSL wrapper), so should not be breaking. |
|
@bastelfreak ,are there any more concerns? |
|
@bastelfreak could you please release this change? |
With this PR trying to use powershell commands for
group_listanduser_listmethods for windows as wmic is deprecated with windows 2025.